/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Database;

import Model.UserSekre;
import java.util.ArrayList;
import javax.swing.table.AbstractTableModel;

public class UserSekreTable extends AbstractTableModel {

    private String columns[] = {"ID User", "Nama User"};
    private ArrayList<UserSekre> datasekre;

    public UserSekreTable() {
    }

    public UserSekreTable(ArrayList<UserSekre> datasekre) {
        this.datasekre = datasekre;
    }

    @Override
    public int getRowCount() {
        return getDataSekre().size();
    }

    public String getColumns(int col) {
        return columns[col];
    }

    @Override
    public int getColumnCount() {
        return columns.length;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        UserSekre sekre = getDataSekre().get(rowIndex);
        if (columnIndex == 0) {
            return sekre.getIdUserSekre();
        } else {
            return sekre.getNamaUserSekre();
        }
    }

    public ArrayList<UserSekre> getDataSekre() {
        return datasekre;
    }

    public void setDataSekre(ArrayList<UserSekre> datasekre) {
        this.datasekre = datasekre;
    }
}
